home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS Toolkit
/
BBS Toolkit.iso
/
pc_board
/
ansi_d.zip
/
ANSI-D.PPS
< prev
next >
Wrap
Text File
|
1993-04-07
|
5KB
|
106 lines
;*****************************************************************************
;* *
;* ANSI DETECTION V1.1 *
;* *
;* written by: Steve Catmull *
;* *
;* started: 03-26-93 *
;* *
;*****************************************************************************
BOOLEAN hasansi ; Result of ANSI - detection test (true or false)
STRING graphdef ; Stores response to the "ask" prompt below
STRING ask ; Constant that contains "want graphics" minus default resp.
INTEGER wtime ; Used as a constant to define seconds to wait - ANSI detect
STRING temp ; Stores the token of what user inputed.
BOOLEAN switch ; Used to help fool around with the defaults.
STRING default_yes ; Used to store setting from PCBOARD.DAT for the default
wtime = 2 ; Seconds to wait for ANSI response
temp = " " ; Initialized to non null for WHILE
switch = FALSE
; /* Notifying the user that ANSI detection is being processed. This keeps
; them entertainment while the "wtime" pause is being executed. */
PRINTLN "Testing your system capability..." ; Amusing the caller.
; /* If you user is connected locally then default autoamtically to ANSI
; capable. Otherwise, send out the escape sequence to get the current
; cursor position. Immediately follow that with a bunch of backspace
; space backspace sequences in case they do not have the ability to
; interpret ANSI. Otherwise, it may be left on the screen. Finally,
; wait for the and ESC followed by a left bracket to be returned. This
; is the only constant part of the ANSI detection that can be tested.
; If that sequence is returned within WTIME seconds, then the caller
; is considered to be ANSI capable and the HASANSI variable shows it.
;
; NOTE: Evidently some terminal programs are quite lazy in returning
; the response to the ANSI detection test. This PPE does not
; attempt to make any accomodations for those programs. Instead,
; it waits "WTIME" seconds and then continues with the best that
; has been determined by that time. */
IF (!ONLOCAL()) THEN
PRINT CHR(27)+"[6n"
PRINT " "
WAITFOR chr(27)+"[",hasansi,wtime
ELSE
hasansi=-1
ENDIF
; /* Assign ASK variable to prompt used for ANSI. The default if enter is
; pressed is ommitted so that it may be built according to their ANSI
; capabilities. */
ask = "Do you want graphics (Enter)="
; /* Read line #257 in PCBOARD.DAT to find out what the default for the
; "Do you want graphics" prompt is. Store the result in DEFAULT_YES.
default_yes = READLINE(PCBDAT(),257)
; /* If the user is capable of ANSI, then default for the "want graphics"
; prompt will be Yes, otherwise, the default is set to "N". The point
; in asking the question is to enable the user to still choose if they
; wish to see color or not, but if they do not know how to answer the
; question, then the default will give them color if they are capable
; of handling it.
IF (hasansi) THEN
ask=ask+"yes"
INPUTSTR ask,graphdef,07,6," ;YQNS",110011010b
IF (!default_yes) THEN
TOKENIZE graphdef ; Necessary because if user
WHILE (!temp="") DO ; enters something like Q
GETTOKEN temp ; at "want graphics" prompt
IF (temp=NOCHAR()) switch=TRUE ; the default should remain.
ENDWHILE ; Since we are fooling PCB
IF (!switch) graphdef=YESCHAR()+";"+graphdef ; we need to handle it.
ENDIF
ELSE
ask=ask+"no"
INPUTSTR ask,graphdef,07,6," ;YQNS",110011010b
IF (default_yes) THEN
TOKENIZE graphdef
WHILE (!temp="") DO
GETTOKEN temp
IF (temp=YESCHAR()) switch=TRUE
ENDWHILE
IF (!switch) graphdef=NOCHAR()+";"+graphdef
ENDIF
ENDIF
;PRINTLN
; /* Now that the "want graphics" prompt has been faked so that the default
; value could be controlled, it is time to stuff the users response to
; the fake prompt to the real prompt. This inludes the "Q and NS"
; parameters. */
KBDSTUFF graphdef
END ; end of script